import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/layouts/HomeLayout.vue'),
      children: [
        { path: '', component: () => import('@/views/home/index.vue') }
      ]
    },
    {
      path: '/movies',
      name: 'movies',
      component: () => import('@/layouts/MainLayout.vue'),
      children: [
        { path: '', component: () => import('@/views/Temp.vue') },
        { path: 'detail/:movieId', component: () => import('@/views/details/index.vue'), props: true },
        { path: 'play/:movieId/', component: () => import('@/views/video/index.vue'), props: true }
      ]
    },
    // {
    //   path: '/detail/:movieId',
    //   name: 'movieDetail',
    //   component: () => import('@/views/details/index.vue'),
    //   props: true // 启用props接收参数
    // },
  ],
})

export default router
